Skip to content

feat(roles): Add support for arguments against roles subcommand - #764

Merged
platinummonkey merged 3 commits into
DataDog:mainfrom
SMITF064:feat/add-support-for-filtering
Aug 25, 2026
Merged

feat(roles): Add support for arguments against roles subcommand#764
platinummonkey merged 3 commits into
DataDog:mainfrom
SMITF064:feat/add-support-for-filtering

Conversation

@SMITF064

@SMITF064 SMITF064 commented Aug 25, 2026

Copy link
Copy Markdown

What does this PR do?

Adds pagination and filtering support to the pup users roles list command. The command previously called the paginated Datadog list-roles API but exposed no arguments, so callers were stuck with the API defaults and had no way to page through or filter results.

The command now accepts --page-size, --page-number, --sort, --filter, and --filter-id, mapping directly to the five fields on the API's ListRolesOptionalParams.

Motivation

UserRoleActions::List hit a paginated endpoint but had no pagination arguments, unlike sibling commands such as users list and organizations policies list. This meant users could only ever retrieve the first page of roles with no control over sorting or filtering. This change brings the command in line with the rest of the CLI's paginated list commands.

Additional Notes

  • Reused the existing RolesSort enum and ListRolesOptionalParams builder from the pinned datadog-api-client-rust crate rather than introducing new types.
  • Followed the Option-field conditional-set pattern already used in organizations::policies_list (src/commands/organizations.rs) for consistency.
  • --sort accepts the API's documented tokens: name, -name, modified_at, -modified_at, user_count, -user_count. Invalid values return an explicit error.
    This validation lives in a parse_roles_sort helper rather than a clap ValueEnum, matching how organizations.rs handles its sort flag. Happy to switch it to clap-level validation if preferred.

Checklist

  • The code change follows the project conventions (see CONTRIBUTING.md)
  • Tests have been added/updated (if applicable)
  • Documentation has been updated (if applicable)
  • All CI checks pass
  • Code coverage is maintained or improved

Related Issues

N/A

@SMITF064
SMITF064 requested a review from a team as a code owner August 25, 2026 18:49
@SMITF064

SMITF064 commented Aug 25, 2026

Copy link
Copy Markdown
Author

@platinummonkey It looks like everything is green, but I do not have the 'Merge Pull Request' button. Do I lack necessary permissions to merge this?
image

@platinummonkey
platinummonkey merged commit 27bb0cc into DataDog:main Aug 25, 2026
6 checks passed
@SMITF064
SMITF064 deleted the feat/add-support-for-filtering branch August 25, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants